<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>开灯关灯-plus</title>
    <style>
        html, body {
            width: 100%;
            height: 100%;
            background-color: black;
        }
        .lamp-box {
            text-align: center;
        }
        .lamp {
            position: relative;
            margin: 0 auto;
        }
        .lamp::before {
            position: relative;
            content: "";
            width: 0px;
            height: 0px;
            border-left: 50px solid transparent;
            border-right: 50px solid transparent;
            border-bottom: 50px solid rgba(107, 106, 106, 1);
            border-top: 0px solid transparent;
            overflow: hidden;
            z-index: 1;
        }
        .lamp::after {
            content: "";
            width: 30px;
            height: 30px;
            position: absolute;
            top: 60px;
            left: 50%;
            transform: translateX(-50%);
            border-radius: 50%;
            background-color: #848484;
        }
        .light::after {
            background-color: #fff;
            box-shadow: 0 0 20px 20px #fff;
        }
        .light::before {
            border-bottom: 50px solid rgba(107, 106, 106, 0.9);
        }
    </style>
</head>
<body>
    <div class="lamp-box">
        <button>开灯</button>
        <div class="lamp"></div>
    </div>
    <script>
        let btn = document.querySelector("button")
        let lamp = document.querySelector(".lamp")
        btn.addEventListener("click", function(){
            let txt = btn.innerText
            if(txt == "开灯"){
                btn.innerText = "关灯"
            }else{
                btn.innerText = "开灯"
            }
            lamp.classList.toggle("light")
        })
    </script>
</body>
</html>